/*
 * @Descripttion:
 * @version: 1.0.0
 * @Author: liuzicheng
 * @Date: 2025-02-10 14:02:57
 * @LastEditors: liuzicheng
 * @LastEditTime: 2025-02-24 16:23:37
 */
import { IRoute } from "@/vite-env";
import { makeAutoObservable } from "mobx";
export interface ITabsStore {
  visitedViewsTabs: IRoute[];
  setVisitedViewsTabs: (tabsObj: IRoute) => void;
  removeVisitedViewsTabs: (path: string) => void;
}
class TabsStore {
  constructor() {
    makeAutoObservable(this);
  }
  visitedViewsTabs: any[] = [];
  setVisitedViewsTabs(tabsObj) {
    if (this.visitedViewsTabs?.every((item) => item?.path != tabsObj?.path) && tabsObj?.path) {
      this.visitedViewsTabs.push(tabsObj);
    }
  }
  removeVisitedViewsTabs(path) {
    this.visitedViewsTabs = this.visitedViewsTabs.filter((item) => item.path !== path);
  }
}

export default new TabsStore();
